<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class ads extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		
		$this->load->database();
		$this->load->helper('url');
		
		$this->load->library('grocery_CRUD');	
	}
	
	function _ads_output($output = null)
	{
		$this->load->view('ads.php',$output);	
	}
	
	function hosts()
	{
		$output = $this->grocery_crud->render();
		$this->_ads_output($output);
	}
	function zones()
	{
		$output = $this->grocery_crud->render();
		$this->_ads_output($output);
	}
	function scripts()
	{
			$crud = new grocery_CRUD();

			$crud->set_table('scripts');
			$crud->set_relation('host','hosts','host');
			$crud->set_relation('zone','zones','zone');
			
			$output = $crud->render();
			
			$this->_ads_output($output);
		
	}
	
	function index()
	{
		$this->_ads_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
	}
}